package com.magic.gre.adapter;

import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.magic.gre.R;
import com.magic.gre.entity.AnswerBean;
import com.magic.gre.entity.AnswerItemBean;
import com.noname.lib_base_java.adapter.CommonAdapter;
import com.noname.lib_base_java.adapter.ViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Lmoumou
 * Date: 2019-01-08 19:20
 * 文件名: AnswerAdapter
 * 描述:
 */
public class AnswerAdapter extends CommonAdapter<AnswerBean> {
    private AnswerItemAdapter.OnAnswerItemClickListener onAnswerItemClickListener;

    public void setOnAnswerItemClickListener(AnswerItemAdapter.OnAnswerItemClickListener onAnswerItemClickListener) {
        this.onAnswerItemClickListener = onAnswerItemClickListener;
    }

    public AnswerAdapter(Context mContext, List<AnswerBean> mData) {
        super(mContext, mData, R.layout.item_answer);

    }

    @Override
    protected void bindData(ViewHolder holder, int position) {
        List<AnswerItemBean> dataList = new ArrayList<>();


        holder.setText(R.id.words_tv, String.valueOf(position));
        RecyclerView mRecyclerView = holder.getView(R.id.mRecyclerView);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        AnswerItemAdapter adapter = new AnswerItemAdapter(mContext, dataList);
        if (onAnswerItemClickListener != null) {
            adapter.setOnAnswerItemClickListener(onAnswerItemClickListener);
        }

        mRecyclerView.setAdapter(adapter);
    }

    @Override
    public int getItemCount() {
        return 3;
    }

}
